﻿

CREATE PROCEDURE [dbo].[balcon_CopiazaSolduriInitialeCapitole]
	@CodUnitate smallint,
	@jurnalSelectat int
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	DISABLE TRIGGER [UpdateParinteJurnaleSolduriInitiale] ON [JurnaleSolduriInitiale];

	INSERT INTO [JurnaleSolduriInitiale]
           ([IDJurnal]
           ,[Cont]
           ,[CodUnitate]
           ,[DebitInitial]
           ,[CreditInital]
           ,[DebitPrecedent]
           ,[CreditPrecedent])
     SELECT @jurnalSelectat,Cont,CodUnitate,DebitInitial,CreditInitial,DebitPrecedent,CreditPrecedent
           FROM Conturi WHERE CodUnitate = @CodUnitate AND Terminal=1;

	 ENABLE TRIGGER  [UpdateParinteJurnaleSolduriInitiale] ON [JurnaleSolduriInitiale]
END